#jb/bin/bash - Pacless
if [ "$(id -u)" != "0" ]; then
echo "此安装脚本必须以根目录运行" 1>&2
exit 1
fi

pushd /var/tmp/

if [ -e /jb/bin/bash ]
then
	echo "Downloading CheatEngine..."
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//bsce.tar
	echo "Installing CE..."
    tar -C / -xpf bsce.tar
	rm -rf bsce.tar
	chown -R  mobile:mobile /Applications/CheatEngineIO.app
       echo "1. 下载和安装依赖项"
	rm -rf unrar_5.5.8_iphoneos-arm.tar.gz
	rm -rf bzip2_1.0.6-2_iphoneos-arm.tar.gz
	rm -rf zip_3.0_iphoneos-arm.tar.gz
	rm -rf p7zip_16.02_iphoneos-arm.tar.gz
	rm -rf unzip_6.0_iphoneos-arm.tar.gz
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//unrar_5.5.8_iphoneos-arm.tar.gz
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//bzip2_1.0.6-2_iphoneos-arm.tar.gz
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//zip_3.0_iphoneos-arm.tar.gz
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//p7zip_16.02_iphoneos-arm.tar.gz
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//unzip_6.0_iphoneos-arm.tar.gz
	tar -C /jb/ -xvf unrar_5.5.8_iphoneos-arm.tar.gz
	tar -C /jb/ -xvf bzip2_1.0.6-2_iphoneos-arm.tar.gz
	tar -C /jb/ -xvf zip_3.0_iphoneos-arm.tar.gz
	tar -C /jb/ -xvf p7zip_16.02_iphoneos-arm.tar.gz
	tar -C /jb/ -xvf unzip_6.0_iphoneos-arm.tar.gz
	rm -rf unrar_5.5.8_iphoneos-arm.tar.gz
	rm -rf bzip2_1.0.6-2_iphoneos-arm.tar.gz
	rm -rf zip_3.0_iphoneos-arm.tar.gz
	rm -rf p7zip_16.02_iphoneos-arm.tar.gz
	rm -rf unzip_6.0_iphoneos-arm.tar.gz
	inject /jb/usr/bin/unrar /jb/usr/lib/p7zip/7z /jb/usr/lib/p7zip/7z.so /jb/usr/lib/p7zip/7zCon.sfx /jb/usr/lib/p7zip/7za /jb/usr/lib/p7zip/Codecs/Rar.so /jb/bin/bunzip2 /jb/bin/bzcat /jb/bin/bzip2 /jb/bin/bzip2recover /jb/usr/bin/unzip /jb/usr/bin/unzipsfx /jb/usr/bin/funzip /jb/usr/bin/zip /jb/usr/bin/zip /jb/usr/bin/zipcloak /jb/usr/bin/zipnote /jb/usr/bin/zipsplit
	echo "2. 下载文件管理器"
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//com.tigisoftware.filza64bit_3.7.0_bins_iphoneos-arm.tar.gz
	wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//com.tigisoftware.filza64bit_3.7.0_apps_iphoneos-arm.tar.gz
	echo "3. 安装Filza文件管理器"
	tar -C /jb/ -xvf com.tigisoftware.filza64bit_3.7.0_bins_iphoneos-arm.tar.gz
	tar -C / -xvf com.tigisoftware.filza64bit_3.7.0_apps_iphoneos-arm.tar.gz
	rm -rf com.tigisoftware.filza64bit_3.7.0_apps_iphoneos-arm.tar.gz
	rm -rf com.tigisoftware.filza64bit_3.7.0_bins_iphoneos-arm.tar.gz
	chown -R  root:wheel /jb/Library/LaunchDaemons/com.tigisoftware.filza.helper.plist
	chown -R  root:wheel /jb/usr/libexec
	chown -R  root:admin /Applications/Filza.app
	chmod ug+s /jb/usr/libexec/filza/Filza
	inject /Applications/Filza.app/Filza /Applications/Filza.app/dylibs/libsmb2-ios.dylib /Applications/Filza.app/PlugIns/Sharing.appex/Sharing /jb/usr/libexec/filza/Filza /jb/usr/libexec/filza/FilzaHelper /jb/usr/libexec/filza/FilzaWebDAVServer
	launchctl unload /jb/Library/LaunchDaemons/com.tigisoftware.filza.helper.plist
	launchctl load -w /jb/Library/LaunchDaemons/com.tigisoftware.filza.helper.plist
	rm -rf /var/root/mterminal-pacless.sh
    echo "正在下载 MTerminal..."
    wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//mterminal_1.4-6_iphoneos-arm.tar
    echo "正在下载 OpenSSH..."
    wget https://gitee.com/aarongod/IOSFakeIGG/raw/master//openssh_7.9p1-3_iphoneos-arm-pacless.tar
    echo "正在安装 MTerminal..."
    tar -C / -xpf mterminal_1.4-6_iphoneos-arm.tar
    rm -rf mterminal_1.4-6_iphoneos-arm.tar
    chown -R  root:wheel /Applications/MTerminal.app
    echo "正在安装 OpenSSH..."
    tar -C / -xpf openssh_7.9p1-3_iphoneos-arm-pacless.tar
    rm -rf openssh_7.9p1-3_iphoneos-arm-pacless.tar
    chown -R  root:wheel /jb/Library/LaunchDaemons/com.openssh.sshd.plist
    launchctl load -w /jb/Library/LaunchDaemons/com.openssh.sshd.plist
    chown -R root:wheel /jb/usr/
    echo "创建链接"
    ln -s /jb/bin/sh /bin/sh
    ln -s /jb/usr/bin/login /usr/bin/login
    ln -s /jb/usr/lib/libcrypto.1.0.0.dylib /usr/lib/libcrypto.1.0.0.dylib
    ln -s /jb/usr/lib/libssl.1.0.0.dylib /usr/lib/libssl.1.0.0.dylib
    mkdir /usr/lib/ssl
    ln -s /jb/usr/lib/ssl/openssl.cnf /usr/lib/ssl/openssl.cnf
       uicache
	   uicache.old
    echo "欢迎关注微信公众号：Aar0n"
    echo "拒绝恶意圈钱"
	echo "安装完成，谢谢使用"
    killall SpringBoard
    popd
fi
